System and method for using virtual directories to service URL requests in application servers

ABSTRACT

The invention provides a system and method for providing virtual directories for servlets, particularly for use by many different Web applications that share common files and resources, and that are intended for providing those resources to large numbers of users. Virtual directories provide a mechanism for automatically changing the root folder from the default Web application (webapp) root document folder (docroot) to a virtual directory or folder, in response to certain http/URL requests. The purpose of the feature is to allow the developer to configure different document roots for certain requests. By doing this they can direct certain kind of requests (particularly those for common resources) to a common document root. Virtual directories ensure that common resources do not have to be copied for all web applications separately, and the burden on the server itself is minimized.

CLAIM OF PRIORITY

[0001] This application claims priority from provisional application “SYSTEM AND METHOD FOR USING VIRTUAL DIRECTORIES TO SERVICE URL REQUESTS IN APPLICATION SERVERS” Application No. 60/349,466 filed Jan. 18, 2002, and which application is incorporated herein by reference.

FIELD OF THE INVENTION

[0002] The invention relates generally to application servers and particularly to a system and method for providing virtual directories for servlets.

CROSS-REFERENCES

[0003] This application is related to U.S. Provisional Patent Application No. 60/349,443, “SYSTEM AND METHOD FOR URL RESPONSE CACHING AND FILTERING IN SERVLETS AND APPLICATION SERVERS” filed Jan. 18, 2002 and U.S. Provisional Patent Application No. 60/349,456, “SYSTEM AND METHOD FOR PLUGGABLE URL PATTERN MATCHING FOR SERVLETS AND APPLICATION SERVERS” filed Jan. 18, 2002, both of which applications are incorporated herein by reference.

BACKGROUND

[0004] An ever-increasing number of e-commerce providers or e-businesses rely on application server technology as the lifeblood of their business. Application servers form a proven foundation for supporting e-commerce applications, providing the presentation, business and information-access logic, security and management services, and underlying infrastructure required for highly scalable and mission-critical software applications. Increasingly, the demands of today's modern businesses require support for a new breed of Web and wireless applications, helping to meet the needs of increasingly sophisticated customers.

[0005] One such application server, WebLogic Server, from BEA Systems, Inc. San Jose, Calif., is based on an implementation of the Java 2 Enterprise Edition (J2EE) specification. WebLogic Server is used as the backbone for many of today's most sophisticated e-business applications, playing an integral role in a tightly integrated, comprehensive infrastructure that delivers commerce, personalization, campaign management, enterprise integration, workflow management, and business-to-business collaboration. From Web and wireless clients to Windows, Unix, and mainframe servers, WebLogic Server manages all of the underlying complexities of a business' e-commerce applications, allowing the organization to focus instead on delivering new and innovative products and services.

[0006] A typical application server, including WebLogic Server, supports a variety of clients, including Web browsers, and wireless devices. On the server side, WebLogic Server supports leading Unix, Linux, Windows, and mainframe operating systems. On the back-end, WebLogic Server integrates with relational databases, messages queues, and legacy systems. WebLogic Server provides support for features such as Servlets, Java Server Pages (JSPs), Enterprise JavaBeans (EJBs), Java Messaging Service (JMS), to provide access to standard network protocols, database, and messaging systems. When developing applications, developers can create, assemble, and deploy components that use these services.

[0007] In a typical deployment, WebLogic Server also includes a Web server for hosting static content and dynamic J2EE Web applications. J2EE Web applications typically include a collection of HTML/XML pages, Java Server Pages, Servlets, Java classes, applets, images, multimedia files, and other file types. WebLogic Server may also be integrated with other Web servers such as Apache, Microsoft IIS, or Netscape Web servers. Web components usually provide the presentation logic for browser-based or wireless applications, while EJB components encapsulate business objects and processes.

[0008] One of the problems with current Web server and application server offerings is that many hundreds, and sometimes thousands, of users may need access to the same resource at the same moment in time, using different web applications. This resource may be a servlet page, JSP, static content html page, or associated images etc. A typical production system may involve multiple web-applications (webapps). In these instances, the J2EE specification doesn't allow sharing of common resources, for example pages, images and other files. As a result the customers (in this context the software developers) end up copying the shared resources multiple times for each webapp. This places great strain on the resources of the application server or Web server, particularly in terms of memory usage.

[0009] Another problem with traditional Web and application server offerings are that files such as images, which may be common to many Web applications, usually need to be copied to the resource space or folder for each application. Web applications typically lack a mechanism by which they can share a single copy of a resource. While centralizing common resource files for all applications is extremely important for Web sites to assist in the setup and maintenance of that Web site, it is an administrative burden to copy the resources for all web applications separately.

[0010] E-commerce providers (developers) would benefit greatly from a convenient mechanism that allows for centralized control of common resources and files, and that reduces the burden on the server of responding to many common http requests.

SUMMARY

[0011] The invention provides a system and method for providing virtual directories for servlets, particularly for use by many different Web applications (webapps) that share common files and resources, and that are intended for providing those resources to large numbers of users. Virtual directories provide a mechanism for automatically changing the docroot of the given Web application to a virtual directory or folder, in response to certain http requests. The purpose of this feature is to allow the developer to configure different document roots for certain requests so that the common resources can be shared between multiple web-applications. By doing this they can direct certain kind of requests (particularly those for common resources) to a common document root.

[0012] For example, by pointing all of the image requests for all web applications in this way, a developer is able to accumulate all of the common images in a common place for all web applications. Virtual directories thus ensure that common resources do not have to be copied for all web applications separately, and that the burden on the server itself is minimized.

[0013] This feature is targeted for applications written according to the J2EE Servlets and JSP specifications. However, virtual directories are not a part of J2EE.

[0014] In accordance with one embodiment, the invention comprises a system for using virtual directories to respond to uniform resource indicator requests in application servers, comprising: a web server component for receiving uniform resource indicator requests and passing said requests to the application server; a resource directory containing shared resources; and, a configuration file for specifying a virtual directory to be mapped to said resource directory and to be used in responding to said uniform resource indicator request.

[0015] In accordance with another embodiment, the invention comprises a method of using virtual directories to respond to uniform resource indicator requests in application servers, comprising the steps of: receiving uniform resource indicator requests at a web server component for communication to the application server; identifying using a configuration file a resource directory to be used; mapping said resource directory to a virtual directory; and, communicating content from said resource directory to said servlet using a mapping of said virtual directory.

BRIEF DESCRIPTION OF THE DRAWINGS

[0016]FIG. 1 shows a plan of a typical browser/application server interaction.

[0017]FIG. 2 shows a plan of an application server using a virtual directory in accordance with an embodiment of the invention.

[0018]FIG. 3 shows a flowchart of a method for providing and using a virtual directory in accordance with an embodiment of the invention.

DETAILED DESCRIPTION

[0019] The invention provides a system and method for providing virtual directories for servlets, particularly for use by many different Web applications that share common files and resources, and that are intended for providing those resources to large numbers of users. Virtual directories provide a mechanism for automatically changing the root folder from the default Web application (webapp) root document folder (docroot) to a virtual directory or folder, in response to certain http/URL requests. The purpose of the feature is to allow the developer to configure different document roots for certain requests. By doing this they can direct certain kind of requests (particularly those for common resources) to a common document root. Virtual directories ensure that common resources do not have to be copied for all web applications separately, and that the burden on the server itself is minimized. Virtual directories are thus useful for saving disk space and for providing better administration.

[0020] Since this feature is not J2EE compliant, some other form of configuration is necessary. In one embodiment an XML file (weblogic.xml) is used to configure the virtual directories. By modifying the settings in the weblogic.xml file, users are able to customize the virtual directories handled by the application (weblogic) server.

[0021]FIG. 1 shows a plan of a typical browser/application server interaction that does not use virtual directories. As shown in FIG. 1, a number (sometimes hundreds or thousands) of users 106,108,110 operating browsers, WAP devices, or some other type of Web access device, interact with an applications server 102 that includes a servlet container 104. The http request may arrive via a Web server, via a load balancer, or even directly to the server, depending on the particular implementation. In the example shown in FIG. 1, each of user A, user B, . . . user N, all try to access the same resource using a variety of different web applications. Typically this access is by means of an http request 112 to the Web server. Access may be through the same or identical application in each instance, or it may be through different applications (webapp1, webapp 2, etc.) that merely use the same resource(s). It will be evident that any kind of resource, including, for example, text, graphical images, and other files, may be requested as part of the http request. Typically, the application server must provide copies of each resource in order to satisfy the needs of each webapp. In FIG. 1, these copies are indicated as resources A1 114, A2 116, and AN 118. Depending-on the webapp used, the different copies of the resource are used to service the respective http requests and provide a response 120 to the user.

[0022] Since the J2EE specification doesn't allow sharing of common resource, the customers (in this context the software developers) must copy the shared resources multiple times for each web application (webapp).

[0023]FIG. 2 shows a plan of an application server using a virtual directory (or virtual directories), in accordance with an embodiment of the invention. As before, a number of users 106, 108, 110 operating browsers, or some other type of Web device, interact with an applications server 102 that includes a servlet container. Again, each of user A, user B, . . . user N, all try to access the same resource by means of an http request 112 to the Web server, using a variety of different web applications. As mentioned above, this access may be through the same or identical application in each user instance, or it may be through different applications (webapp1, webapp 2, etc.) that merely use the same resource. This time, instead of providing copies of the required resource, the system checks the URL request against a previously configured XML configuration file 125 to see if a matching pattern exists, and to determine whether the resource is stored in the virtual directory 126. If the virtual directory indicates a mapped docroot, then the system allows concurrent synchronized access to that shared resource 128. The shared resource is then used to service the respective http requests and provide a response 130 to the user.

[0024] In this way, virtual directories provide a mechanism for automatically changing the docroot of the given Web application to a virtual directory or folder, in response to certain http requests. The developer may configure different document roots for certain requests so that any common resources can be shared between multiple web-applications. From the user's perspective the end result is the same, but from an administrative point of view the virtual directory is easier to manage, and the ability to provide shared access to a single resource places less performance burden on the application server. The invention thus allows the administrator to specify common resources (i.e. multiple instances of servlets, images etc). For example GIF and jpg images can be placed in a (typically read-only) virtual directory. When the system receives a request to access one of these images the request is redirected to the virtual directory. Using this method the system can satisfy the needs of many customers, using a variety of webapps, with only a single instance of the resource.

[0025]FIG. 3 shows a flowchart of a method for providing and using a virtual directory in accordance with the invention. In step 140, the system receives a request from a user of client browser for a particular URL. In step 142, the configuration file (in one embodiment the weblogic.xml file) is searched to find any matching virtual directories. If one exists, the system determines, in step 144, the resource location using the virtual directory. In step 146, the request is satisfied by retrieving the resource from the shared directory. If for some reason the virtual directory fails or dies then the system returns a null or“not found” unless the virtual directory has been installed in some failover manner on a shared file system. In any case re-sending the http request should be enough to retrieve a new copy from another node in the cluster.

Configuration File (Weblogic.xml) Syntax

[0026] An administrator or developer can administer, monitor, or tune the virtual directories either through an administrative console or directly by editing the configuration file. Virtual directories are configured in the same manner as the servlet mappings. The developer must provide a mapping of certain uri's to physical location on the disk. The document root will be set when the request is being resolved. The pattern matching is performed similarly to the pattern matching for HTTP requests as per J2EE. The virtual directories's local path can be a directory or a jar file. The Servlet Container should be able to handle both the cases. For an incoming request, if a virtual directory has been specified then the Servlet Container will search for the requested resource first in the virtual directory and if not found there then it will look into the webapp's original doc root. This defines the precedence if the same document exists in both places.

[0027] The syntax of an entry in the configuration file (for Weblogic server the weblogic.xml file is used although it will be evident that any other type of configuration file could be equally used) is as follows:

[0028] <!--

[0029] <!ELEMENT virtual-directory-mapping (local-path, url-pattern)>

[0030] -->

[0031] Within the xml file statement shown above, the local-path element specifies a physical location on the disk at which the resource, image, object etc. is stored. The url-pattern element contains the url pattern of the mapping, i.e. the URL request that the server receives from the user or client browser.

[0032] By specifying virtual directory mappings a developer can change the default docroot for certain requests. Virtual-directory-mapping thus defines a mapping between a physical directory location and a url pattern within a request. A given request will be resolved to exactly one document root. If none of the register patterns matches the incoming URI then the doc root will be default to the webapp docroot.

[0033] The following examples illustrate how a url-pattern can be used to map a virtual directory on to a folder. In this example, a URL request including the pattern “/images/” or “.JPG” is mapped into the c:/usr/gifs local directory. Similarly, a URL request including the pattern “.JSP” is mapped into a JAR file c:/usr/common_jsps.jar.

[0034] <virtual-directory-mapping>

[0035] <local-path>c:/usr/gifs</local-path>

[0036] <url-pattern>/images/*</url-pattern>

[0037] <url-pattern>*.jpg</url-pattern>

[0038] </virtual-directory>

[0039] <virtual-directory-mapping>

[0040] <local-path>c:/usr/common_jsps.jar</local-path>

[0041] <url-pattern>*.jsp</url-pattern>

[0042] </virtual-directory>

[0043] Incorporating the virtual directory feature into existing application servers should have no impact on the runtime performance of the servlet engine, since the virtual directory feature is only actually used when virtual directories are specified in the configuration file. If no virtual directories are registered with the engine, then the runtime performance should not change.

[0044] The present invention may be conveniently implemented using a conventional general purpose or a specialized digital computer or microprocessor programmed according to the teachings of the present disclosure. Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.

[0045] In some embodiments, the present invention includes a computer program product which is a storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. The storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.

[0046] The foregoing description of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. Particularly, it will be evident that the virtual directory feature described above can be used to serve other resources and file types beyond those described. Also, it should be noted that the virtual directory feature can be used with other features such as response caching, described in further detail in U.S. Provisional Patent Application No. 60/349,443, “SYSTEM AND METHOD FOR URL RESPONSE CACHING AND FILTERING IN SERVLETS AND APPLICATION SERVERS” filed Jan. 18, 2002, to provide a high performance means of sharing data and serving that data to the user. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence. 

What is claimed is:
 1. A system for using virtual directories to respond to uniform resource indicator requests in application servers, comprising: an application server including a servlet container for receiving uniform resource indicator requests; a resource directory containing shared resources; and, a configuration file for specifying a virtual directory to be mapped to said resource directory and to be used in responding to said uniform resource indicator request.
 2. The system of claim 1 wherein said uniform resource indicator requests are received from a user operating a web browser application.
 3. The system of claim 1 wherein said uniform resource indicator requests are received from a software application.
 4. The system of claim 1 wherein the configuration file is an extensible markup language file containing a plurality of entries defining the configuration of the application server environment.
 5. The system of claim 4 wherein the virtual directory is specified as an entry in the extensible markup language file.
 6. The system of claim 1 wherein the application server is a weblogic server and said extensible markup language file is the weblogic.xml file.
 7. The system of claim 1 wherein the virtual directory is specified as an entry in the configuration file, and wherein said entry includes a local-path element for specifying a physical location on a disk at which the shared resource is stored, and a uri-pattern element for specifying the pattern of the uniform resource indicator request received by the web server component.
 8. The system of claim 1 wherein a plurality of virtual directories can be mapped to a single resource directory
 9. The system of claim 1 wherein said plurality of virtual directories are accessible by a plurality of different servlet applications, and wherein each servlet application uses it's own virtual directory to access the resource directory.
 10. The system of claim 7 wherein the virtual directories's local path is an actual directory.
 11. The system of claim 7 wherein the virtual directories's local path is a JAR file.
 12. A method of using virtual directories to respond to uniform resource indicator requests in application servers, comprising the steps of: receiving uniform resource indicator requests at a servlet container for use by an application server; identifying using a configuration file a resource directory to be used; mapping said resource directory to a virtual directory; and, communicating content from said resource directory to said servlet using a mapping of said virtual directory.
 13. The method of claim 12 wherein said uniform resource indicator requests are received from a user operating a web browser application.
 14. The method of claim 12 wherein said uniform resource indicator requests are received from a software application.
 15. The method of claim 12 wherein the configuration file is an extensible markup language file containing a plurality of entries defining the configuration of the application server environment.
 16. The method of claim 15 wherein the virtual directory is specified as an entry in the extensible markup language file.
 17. The method of claim 12 wherein the application server is a weblogic server and said extensible markup language file is the weblogic.xml file.
 18. The method of claim 12 wherein the virtual directory is specified as an entry in the configuration file, and wherein said entry includes a local-path element for specifying a physical location on a disk at which the shared resource is stored, and a uri-pattern element for specifying the pattern of the uniform resource indicator request received by the web server component.
 19. The method of claim 12 wherein a plurality of virtual directories can be mapped to a single resource directory
 20. The method of claim 12 wherein said plurality of virtual directories are accessible by a plurality of different servlet applications, and wherein each servlet application uses it's own virtual directory to access the resource directory.
 21. The method of claim 18 wherein the virtual directories's local path is an actual directory.
 22. The method of claim 18 wherein the virtual directories's local path is a JAR file. 